package com.jetgege.smartbox.Base;

import android.app.Activity;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by JJT-ssd on 2017/2/3.
 */

public  class ActivityCollector {
    public static List<Activity> activities=new ArrayList<>();
    public static void addActivity(Activity activity)
    {
        activities.add(activity);
    }
    public static void removeActivity(Activity activity)
    {
        activities.remove(activity);
    }
    public static boolean finishAll()
    {
        boolean isFinish =false;
        for (Activity activity:activities)
        {

            if (!activity.isFinishing()){
                activity.finish();
                isFinish=false;
            }else isFinish =true;
        }
        return isFinish;
    }
}
